package grupb.upf.imageProcessing;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;

public final class CrossAnnotation extends DrawableAnnotation {
	private Point2D center; // Center of the cross
	private double width; // Width of the cross
	private double height; // Height of the cross
	private BasicStroke stroke; // Thickness of the stroke

	public CrossAnnotation(final Point2D c, final double w, final double h,
            final float pw) {
		center = c;
		width = w;
		height = h;
		stroke = new BasicStroke(pw);
	}

	// Concrete implementation of the paint method
    @Override
	public void paint(final Graphics2D g2d) {
		final int x = (int) center.getX();
		final int y = (int) center.getY();
		final int xmin = (int) (x - width / 2);
		final int xmax = (int) (x + width / 2);
		final int ymin = (int) (y - height / 2);
		final int ymax = (int) (y + height / 2);
		g2d.setStroke(stroke);
		g2d.setColor(Color.RED);
		g2d.drawLine(xmin, y, xmax, y);
		g2d.drawLine(x, ymin, x, ymax);
	}
}

